package com.tcat.user.mapper;

import com.tcat.common.vo.PageResult;
import com.tcat.user.pojo.Permissions;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface PermissionMapper extends Mapper<Permissions> {


    /**
     * 根据角色id查询权限
     * * @param uid
     * @return
     */
    @Select("SELECT * FROM tb_permissions WHERE permission_id IN(SELECT pid FROM tb_rps Where rid = #{rid})")
    List<Permissions> queryByRoleId(@Param("rid") Long rid);

    @Delete("DELETE FROM tb_rps WHERE pid=#{pid}")
    void deleteByPermissionsInRps(Long pid);
}
